Merge "Normalize `input[type="search"]`"
[lhc/web/wiklou.git] / tests / phpunit / includes / WatchedItemStoreUnitTest.php
index afde88c..78231c2 100644 (file)
@@ -5,7 +5,7 @@
  *
  * @covers WatchedItemStore
  */
-class WatchedItemStoreUnitTest extends PHPUnit_Framework_TestCase {
+class WatchedItemStoreUnitTest extends MediaWikiTestCase {
 
        /**
         * @return PHPUnit_Framework_MockObject_MockObject|IDatabase
@@ -82,23 +82,19 @@ class WatchedItemStoreUnitTest extends PHPUnit_Framework_TestCase {
                return $fakeRow;
        }
 
+       private function newWatchedItemStore( LoadBalancer $loadBalancer, HashBagOStuff $cache ) {
+               return new WatchedItemStore(
+                       $loadBalancer,
+                       $cache
+               );
+       }
+
        public function testGetDefaultInstance() {
                $instanceOne = WatchedItemStore::getDefaultInstance();
                $instanceTwo = WatchedItemStore::getDefaultInstance();
                $this->assertSame( $instanceOne, $instanceTwo );
        }
 
-       public function testOverrideDefaultInstance() {
-               $instance = WatchedItemStore::getDefaultInstance();
-               $scopedOverride = $instance->overrideDefaultInstance( null );
-
-               $this->assertNotSame( $instance, WatchedItemStore::getDefaultInstance() );
-
-               unset( $scopedOverride );
-
-               $this->assertSame( $instance, WatchedItemStore::getDefaultInstance() );
-       }
-
        public function testCountWatchedItems() {
                $user = $this->getMockNonAnonUserWithId( 1 );
 
@@ -120,7 +116,7 @@ class WatchedItemStoreUnitTest extends PHPUnit_Framework_TestCase {
                $mockCache->expects( $this->never() )->method( 'set' );
                $mockCache->expects( $this->never() )->method( 'delete' );
 
-               $store = new WatchedItemStore(
+               $store = $this->newWatchedItemStore(
                        $this->getMockLoadBalancer( $mockDb ),
                        $mockCache
                );
@@ -150,7 +146,7 @@ class WatchedItemStoreUnitTest extends PHPUnit_Framework_TestCase {
                $mockCache->expects( $this->never() )->method( 'set' );
                $mockCache->expects( $this->never() )->method( 'delete' );
 
-               $store = new WatchedItemStore(
+               $store = $this->newWatchedItemStore(
                        $this->getMockLoadBalancer( $mockDb ),
                        $mockCache
                );
@@ -201,7 +197,7 @@ class WatchedItemStoreUnitTest extends PHPUnit_Framework_TestCase {
                $mockCache->expects( $this->never() )->method( 'set' );
                $mockCache->expects( $this->never() )->method( 'delete' );
 
-               $store = new WatchedItemStore(
+               $store = $this->newWatchedItemStore(
                        $this->getMockLoadBalancer( $mockDb ),
                        $mockCache
                );
@@ -267,7 +263,7 @@ class WatchedItemStoreUnitTest extends PHPUnit_Framework_TestCase {
                $mockCache->expects( $this->never() )->method( 'set' );
                $mockCache->expects( $this->never() )->method( 'delete' );
 
-               $store = new WatchedItemStore(
+               $store = $this->newWatchedItemStore(
                        $this->getMockLoadBalancer( $mockDb ),
                        $mockCache
                );
@@ -315,7 +311,7 @@ class WatchedItemStoreUnitTest extends PHPUnit_Framework_TestCase {
                $mockCache->expects( $this->never() )->method( 'get' );
                $mockCache->expects( $this->never() )->method( 'delete' );
 
-               $store = new WatchedItemStore(
+               $store = $this->newWatchedItemStore(
                        $this->getMockLoadBalancer( $mockDb ),
                        $mockCache
                );
@@ -394,7 +390,7 @@ class WatchedItemStoreUnitTest extends PHPUnit_Framework_TestCase {
                $mockCache->expects( $this->never() )->method( 'set' );
                $mockCache->expects( $this->never() )->method( 'delete' );
 
-               $store = new WatchedItemStore(
+               $store = $this->newWatchedItemStore(
                        $this->getMockLoadBalancer( $mockDb ),
                        $mockCache
                );
@@ -496,7 +492,7 @@ class WatchedItemStoreUnitTest extends PHPUnit_Framework_TestCase {
                $mockCache->expects( $this->never() )->method( 'set' );
                $mockCache->expects( $this->never() )->method( 'delete' );
 
-               $store = new WatchedItemStore(
+               $store = $this->newWatchedItemStore(
                        $this->getMockLoadBalancer( $mockDb ),
                        $mockCache
                );
@@ -549,7 +545,7 @@ class WatchedItemStoreUnitTest extends PHPUnit_Framework_TestCase {
                $mockCache->expects( $this->never() )->method( 'set' );
                $mockCache->expects( $this->never() )->method( 'delete' );
 
-               $store = new WatchedItemStore(
+               $store = $this->newWatchedItemStore(
                        $this->getMockLoadBalancer( $mockDb ),
                        $mockCache
                );
@@ -586,7 +582,7 @@ class WatchedItemStoreUnitTest extends PHPUnit_Framework_TestCase {
                $mockCache->expects( $this->never() )->method( 'get' );
                $mockCache->expects( $this->never() )->method( 'delete' );
 
-               $store = new WatchedItemStore(
+               $store = $this->newWatchedItemStore(
                        $this->getMockLoadBalancer( $mockDb ),
                        $mockCache
                );
@@ -620,7 +616,7 @@ class WatchedItemStoreUnitTest extends PHPUnit_Framework_TestCase {
                $mockCache->expects( $this->never() )->method( 'get' );
                $mockCache->expects( $this->never() )->method( 'delete' );
 
-               $store = new WatchedItemStore(
+               $store = $this->newWatchedItemStore(
                        $this->getMockLoadBalancer( $mockDb ),
                        $mockCache
                );
@@ -657,7 +653,7 @@ class WatchedItemStoreUnitTest extends PHPUnit_Framework_TestCase {
                $mockCache->expects( $this->never() )->method( 'get' );
                $mockCache->expects( $this->never() )->method( 'delete' );
 
-               $store = new WatchedItemStore(
+               $store = $this->newWatchedItemStore(
                        $this->getMockLoadBalancer( $mockDb ),
                        $mockCache
                );
@@ -687,7 +683,7 @@ class WatchedItemStoreUnitTest extends PHPUnit_Framework_TestCase {
                        )
                        ->will( $this->returnValue( new FakeResultWrapper( [] ) ) );
 
-               $store = new WatchedItemStore(
+               $store = $this->newWatchedItemStore(
                        $this->getMockLoadBalancer( $mockDb ),
                        $this->getMockCache()
                );
@@ -745,7 +741,7 @@ class WatchedItemStoreUnitTest extends PHPUnit_Framework_TestCase {
                $mockCache->expects( $this->never() )->method( 'get' );
                $mockCache->expects( $this->never() )->method( 'delete' );
 
-               $store = new WatchedItemStore(
+               $store = $this->newWatchedItemStore(
                        $this->getMockLoadBalancer( $mockDb ),
                        $mockCache
                );
@@ -791,7 +787,7 @@ class WatchedItemStoreUnitTest extends PHPUnit_Framework_TestCase {
                $mockCache->expects( $this->never() )->method( 'get' );
                $mockCache->expects( $this->never() )->method( 'delete' );
 
-               $store = new WatchedItemStore(
+               $store = $this->newWatchedItemStore(
                        $this->getMockLoadBalancer( $mockDb ),
                        $mockCache
                );
@@ -871,7 +867,7 @@ class WatchedItemStoreUnitTest extends PHPUnit_Framework_TestCase {
                $mockCache->expects( $this->never() )->method( 'get' );
                $mockCache->expects( $this->never() )->method( 'delete' );
 
-               $store = new WatchedItemStore(
+               $store = $this->newWatchedItemStore(
                        $this->getMockLoadBalancer( $mockDb ),
                        $mockCache
                );
@@ -903,7 +899,7 @@ class WatchedItemStoreUnitTest extends PHPUnit_Framework_TestCase {
                        ->method( 'delete' )
                        ->with( '0:Some_Page:1' );
 
-               $store = new WatchedItemStore(
+               $store = $this->newWatchedItemStore(
                        $this->getMockLoadBalancer( $mockDb ),
                        $mockCache
                );
@@ -923,7 +919,7 @@ class WatchedItemStoreUnitTest extends PHPUnit_Framework_TestCase {
                $mockCache->expects( $this->never() )
                        ->method( 'delete' );
 
-               $store = new WatchedItemStore(
+               $store = $this->newWatchedItemStore(
                        $this->getMockLoadBalancer( $mockDb ),
                        $mockCache
                );
@@ -934,7 +930,7 @@ class WatchedItemStoreUnitTest extends PHPUnit_Framework_TestCase {
                );
        }
 
-       public function testAddWatchBatch_nonAnonymousUser() {
+       public function testAddWatchBatchForUser_nonAnonymousUser() {
                $mockDb = $this->getMockDb();
                $mockDb->expects( $this->once() )
                        ->method( 'insert' )
@@ -966,7 +962,7 @@ class WatchedItemStoreUnitTest extends PHPUnit_Framework_TestCase {
                        ->method( 'delete' )
                        ->with( '1:Some_Page:1' );
 
-               $store = new WatchedItemStore(
+               $store = $this->newWatchedItemStore(
                        $this->getMockLoadBalancer( $mockDb ),
                        $mockCache
                );
@@ -974,52 +970,14 @@ class WatchedItemStoreUnitTest extends PHPUnit_Framework_TestCase {
                $mockUser = $this->getMockNonAnonUserWithId( 1 );
 
                $this->assertTrue(
-                       $store->addWatchBatch(
-                               [
-                                       [ $mockUser, new TitleValue( 0, 'Some_Page' ) ],
-                                       [ $mockUser, new TitleValue( 1, 'Some_Page' ) ],
-                               ]
-                       )
-               );
-       }
-
-       public function testAddWatchBatch_anonymousUserCombinationsAreSkipped() {
-               $mockDb = $this->getMockDb();
-               $mockDb->expects( $this->once() )
-                       ->method( 'insert' )
-                       ->with(
-                               'watchlist',
-                               [
-                                       [
-                                               'wl_user' => 1,
-                                               'wl_namespace' => 0,
-                                               'wl_title' => 'Some_Page',
-                                               'wl_notificationtimestamp' => null,
-                                       ]
-                               ]
-                       );
-
-               $mockCache = $this->getMockCache();
-               $mockCache->expects( $this->once() )
-                       ->method( 'delete' )
-                       ->with( '0:Some_Page:1' );
-
-               $store = new WatchedItemStore(
-                       $this->getMockLoadBalancer( $mockDb ),
-                       $mockCache
-               );
-
-               $this->assertTrue(
-                       $store->addWatchBatch(
-                               [
-                                       [ $this->getMockNonAnonUserWithId( 1 ), new TitleValue( 0, 'Some_Page' ) ],
-                                       [ $this->getAnonUser(), new TitleValue( 0, 'Other_Page' ) ],
-                               ]
+                       $store->addWatchBatchForUser(
+                               $mockUser,
+                               [ new TitleValue( 0, 'Some_Page' ), new TitleValue( 1, 'Some_Page' ) ]
                        )
                );
        }
 
-       public function testAddWatchBatchReturnsFalse_whenOnlyGivenAnonymousUserCombinations() {
+       public function testAddWatchBatchForUser_anonymousUsersAreSkipped() {
                $mockDb = $this->getMockDb();
                $mockDb->expects( $this->never() )
                        ->method( 'insert' );
@@ -1028,23 +986,21 @@ class WatchedItemStoreUnitTest extends PHPUnit_Framework_TestCase {
                $mockCache->expects( $this->never() )
                        ->method( 'delete' );
 
-               $store = new WatchedItemStore(
+               $store = $this->newWatchedItemStore(
                        $this->getMockLoadBalancer( $mockDb ),
                        $mockCache
                );
 
-               $anonUser = $this->getAnonUser();
                $this->assertFalse(
-                       $store->addWatchBatch(
-                               [
-                                       [ $anonUser, new TitleValue( 0, 'Some_Page' ) ],
-                                       [ $anonUser, new TitleValue( 1, 'Other_Page' ) ],
-                               ]
+                       $store->addWatchBatchForUser(
+                               $this->getAnonUser(),
+                               [ new TitleValue( 0, 'Other_Page' ) ]
                        )
                );
        }
 
-       public function testAddWatchBatchReturnsFalse_whenGivenEmptyList() {
+       public function testAddWatchBatchReturnsTrue_whenGivenEmptyList() {
+               $user = $this->getMockNonAnonUserWithId( 1 );
                $mockDb = $this->getMockDb();
                $mockDb->expects( $this->never() )
                        ->method( 'insert' );
@@ -1053,13 +1009,13 @@ class WatchedItemStoreUnitTest extends PHPUnit_Framework_TestCase {
                $mockCache->expects( $this->never() )
                        ->method( 'delete' );
 
-               $store = new WatchedItemStore(
+               $store = $this->newWatchedItemStore(
                        $this->getMockLoadBalancer( $mockDb ),
                        $mockCache
                );
 
-               $this->assertFalse(
-                       $store->addWatchBatch( [] )
+               $this->assertTrue(
+                       $store->addWatchBatchForUser( $user, [] )
                );
        }
 
@@ -1087,7 +1043,7 @@ class WatchedItemStoreUnitTest extends PHPUnit_Framework_TestCase {
                                '0:SomeDbKey:1'
                        );
 
-               $store = new WatchedItemStore(
+               $store = $this->newWatchedItemStore(
                        $this->getMockLoadBalancer( $mockDb ),
                        $mockCache
                );
@@ -1121,7 +1077,7 @@ class WatchedItemStoreUnitTest extends PHPUnit_Framework_TestCase {
                $mockCache->expects( $this->never() )->method( 'get' );
                $mockCache->expects( $this->never() )->method( 'delete' );
 
-               $store = new WatchedItemStore(
+               $store = $this->newWatchedItemStore(
                        $this->getMockLoadBalancer( $mockDb ),
                        $mockCache
                );
@@ -1143,7 +1099,7 @@ class WatchedItemStoreUnitTest extends PHPUnit_Framework_TestCase {
                $mockCache->expects( $this->never() )->method( 'get' );
                $mockCache->expects( $this->never() )->method( 'delete' );
 
-               $store = new WatchedItemStore(
+               $store = $this->newWatchedItemStore(
                        $this->getMockLoadBalancer( $mockDb ),
                        $mockCache
                );
@@ -1178,7 +1134,7 @@ class WatchedItemStoreUnitTest extends PHPUnit_Framework_TestCase {
                        ->method( 'delete' )
                        ->with( '0:SomeDbKey:1' );
 
-               $store = new WatchedItemStore(
+               $store = $this->newWatchedItemStore(
                        $this->getMockLoadBalancer( $mockDb ),
                        $mockCache
                );
@@ -1213,7 +1169,7 @@ class WatchedItemStoreUnitTest extends PHPUnit_Framework_TestCase {
                        ->method( 'delete' )
                        ->with( '0:SomeDbKey:1' );
 
-               $store = new WatchedItemStore(
+               $store = $this->newWatchedItemStore(
                        $this->getMockLoadBalancer( $mockDb ),
                        $mockCache
                );
@@ -1236,7 +1192,7 @@ class WatchedItemStoreUnitTest extends PHPUnit_Framework_TestCase {
                $mockCache->expects( $this->never() )
                        ->method( 'delete' );
 
-               $store = new WatchedItemStore(
+               $store = $this->newWatchedItemStore(
                        $this->getMockLoadBalancer( $mockDb ),
                        $mockCache
                );
@@ -1280,7 +1236,7 @@ class WatchedItemStoreUnitTest extends PHPUnit_Framework_TestCase {
                                '0:SomeDbKey:1'
                        );
 
-               $store = new WatchedItemStore(
+               $store = $this->newWatchedItemStore(
                        $this->getMockLoadBalancer( $mockDb ),
                        $mockCache
                );
@@ -1314,7 +1270,7 @@ class WatchedItemStoreUnitTest extends PHPUnit_Framework_TestCase {
                        )
                        ->will( $this->returnValue( $cachedItem ) );
 
-               $store = new WatchedItemStore(
+               $store = $this->newWatchedItemStore(
                        $this->getMockLoadBalancer( $mockDb ),
                        $mockCache
                );
@@ -1351,7 +1307,7 @@ class WatchedItemStoreUnitTest extends PHPUnit_Framework_TestCase {
                        ->with( '0:SomeDbKey:1' )
                        ->will( $this->returnValue( false ) );
 
-               $store = new WatchedItemStore(
+               $store = $this->newWatchedItemStore(
                        $this->getMockLoadBalancer( $mockDb ),
                        $mockCache
                );
@@ -1374,7 +1330,7 @@ class WatchedItemStoreUnitTest extends PHPUnit_Framework_TestCase {
                $mockCache->expects( $this->never() )->method( 'get' );
                $mockCache->expects( $this->never() )->method( 'delete' );
 
-               $store = new WatchedItemStore(
+               $store = $this->newWatchedItemStore(
                        $this->getMockLoadBalancer( $mockDb ),
                        $mockCache
                );
@@ -1414,7 +1370,7 @@ class WatchedItemStoreUnitTest extends PHPUnit_Framework_TestCase {
                $mockCache->expects( $this->never() )->method( 'get' );
                $mockCache->expects( $this->never() )->method( 'set' );
 
-               $store = new WatchedItemStore(
+               $store = $this->newWatchedItemStore(
                        $this->getMockLoadBalancer( $mockDb ),
                        $mockCache
                );
@@ -1464,7 +1420,7 @@ class WatchedItemStoreUnitTest extends PHPUnit_Framework_TestCase {
                        )
                        ->will( $this->returnValue( [] ) );
 
-               $store = new WatchedItemStore(
+               $store = $this->newWatchedItemStore(
                        $mockLoadBalancer,
                        $mockCache
                );
@@ -1477,7 +1433,7 @@ class WatchedItemStoreUnitTest extends PHPUnit_Framework_TestCase {
        }
 
        public function testGetWatchedItemsForUser_badSortOptionThrowsException() {
-               $store = new WatchedItemStore(
+               $store = $this->newWatchedItemStore(
                        $this->getMockLoadBalancer( $this->getMockDb() ),
                        $this->getMockCache()
                );
@@ -1518,7 +1474,7 @@ class WatchedItemStoreUnitTest extends PHPUnit_Framework_TestCase {
                                '0:SomeDbKey:1'
                        );
 
-               $store = new WatchedItemStore(
+               $store = $this->newWatchedItemStore(
                        $this->getMockLoadBalancer( $mockDb ),
                        $mockCache
                );
@@ -1554,7 +1510,7 @@ class WatchedItemStoreUnitTest extends PHPUnit_Framework_TestCase {
                        ->with( '0:SomeDbKey:1' )
                        ->will( $this->returnValue( false ) );
 
-               $store = new WatchedItemStore(
+               $store = $this->newWatchedItemStore(
                        $this->getMockLoadBalancer( $mockDb ),
                        $mockCache
                );
@@ -1577,7 +1533,7 @@ class WatchedItemStoreUnitTest extends PHPUnit_Framework_TestCase {
                $mockCache->expects( $this->never() )->method( 'get' );
                $mockCache->expects( $this->never() )->method( 'delete' );
 
-               $store = new WatchedItemStore(
+               $store = $this->newWatchedItemStore(
                        $this->getMockLoadBalancer( $mockDb ),
                        $mockCache
                );
@@ -1644,7 +1600,7 @@ class WatchedItemStoreUnitTest extends PHPUnit_Framework_TestCase {
                $mockCache->expects( $this->never() )->method( 'set' );
                $mockCache->expects( $this->never() )->method( 'delete' );
 
-               $store = new WatchedItemStore(
+               $store = $this->newWatchedItemStore(
                        $this->getMockLoadBalancer( $mockDb ),
                        $mockCache
                );
@@ -1694,7 +1650,7 @@ class WatchedItemStoreUnitTest extends PHPUnit_Framework_TestCase {
                $mockCache->expects( $this->never() )->method( 'set' );
                $mockCache->expects( $this->never() )->method( 'delete' );
 
-               $store = new WatchedItemStore(
+               $store = $this->newWatchedItemStore(
                        $this->getMockLoadBalancer( $mockDb ),
                        $mockCache
                );
@@ -1755,7 +1711,7 @@ class WatchedItemStoreUnitTest extends PHPUnit_Framework_TestCase {
                $mockCache->expects( $this->never() )->method( 'set' );
                $mockCache->expects( $this->never() )->method( 'delete' );
 
-               $store = new WatchedItemStore(
+               $store = $this->newWatchedItemStore(
                        $this->getMockLoadBalancer( $mockDb ),
                        $mockCache
                );
@@ -1795,7 +1751,7 @@ class WatchedItemStoreUnitTest extends PHPUnit_Framework_TestCase {
                $mockCache->expects( $this->never() )->method( 'set' );
                $mockCache->expects( $this->never() )->method( 'delete' );
 
-               $store = new WatchedItemStore(
+               $store = $this->newWatchedItemStore(
                        $this->getMockLoadBalancer( $mockDb ),
                        $mockCache
                );
@@ -1821,7 +1777,7 @@ class WatchedItemStoreUnitTest extends PHPUnit_Framework_TestCase {
                $mockCache = $this->getMockCache();
                $mockCache->expects( $this->never() )->method( $this->anything() );
 
-               $store = new WatchedItemStore(
+               $store = $this->newWatchedItemStore(
                        $this->getMockLoadBalancer( $mockDb ),
                        $mockCache
                );
@@ -1845,7 +1801,7 @@ class WatchedItemStoreUnitTest extends PHPUnit_Framework_TestCase {
                $mockCache->expects( $this->never() )->method( 'set' );
                $mockCache->expects( $this->never() )->method( 'delete' );
 
-               $store = new WatchedItemStore(
+               $store = $this->newWatchedItemStore(
                        $this->getMockLoadBalancer( $mockDb ),
                        $mockCache
                );
@@ -1878,7 +1834,7 @@ class WatchedItemStoreUnitTest extends PHPUnit_Framework_TestCase {
                $mockCache->expects( $this->never() )->method( 'set' );
                $mockCache->expects( $this->never() )->method( 'delete' );
 
-               $store = new WatchedItemStore(
+               $store = $this->newWatchedItemStore(
                        $this->getMockLoadBalancer( $mockDb ),
                        $mockCache
                );
@@ -1923,7 +1879,7 @@ class WatchedItemStoreUnitTest extends PHPUnit_Framework_TestCase {
                        ->method( 'delete' )
                        ->with( '0:SomeDbKey:1' );
 
-               $store = new WatchedItemStore(
+               $store = $this->newWatchedItemStore(
                        $this->getMockLoadBalancer( $mockDb ),
                        $mockCache
                );
@@ -1963,7 +1919,7 @@ class WatchedItemStoreUnitTest extends PHPUnit_Framework_TestCase {
                $mockDb->expects( $this->never() )
                        ->method( 'delete' );
 
-               $store = new WatchedItemStore(
+               $store = $this->newWatchedItemStore(
                        $this->getMockLoadBalancer( $mockDb ),
                        $mockCache
                );
@@ -2029,7 +1985,7 @@ class WatchedItemStoreUnitTest extends PHPUnit_Framework_TestCase {
                $mockDb->expects( $this->never() )
                        ->method( 'delete' );
 
-               $store = new WatchedItemStore(
+               $store = $this->newWatchedItemStore(
                        $this->getMockLoadBalancer( $mockDb ),
                        $mockCache
                );
@@ -2089,7 +2045,7 @@ class WatchedItemStoreUnitTest extends PHPUnit_Framework_TestCase {
                $mockDb->expects( $this->never() )
                        ->method( 'delete' );
 
-               $store = new WatchedItemStore(
+               $store = $this->newWatchedItemStore(
                        $this->getMockLoadBalancer( $mockDb ),
                        $mockCache
                );
@@ -2170,7 +2126,7 @@ class WatchedItemStoreUnitTest extends PHPUnit_Framework_TestCase {
                $mockCache->expects( $this->never() )->method( 'get' );
                $mockCache->expects( $this->never() )->method( 'delete' );
 
-               $store = new WatchedItemStore(
+               $store = $this->newWatchedItemStore(
                        $this->getMockLoadBalancer( $mockDb ),
                        $mockCache
                );
@@ -2212,7 +2168,7 @@ class WatchedItemStoreUnitTest extends PHPUnit_Framework_TestCase {
                $mockCache->expects( $this->never() )->method( 'get' );
                $mockCache->expects( $this->never() )->method( 'delete' );
 
-               $store = new WatchedItemStore(
+               $store = $this->newWatchedItemStore(
                        $this->getMockLoadBalancer( $mockDb ),
                        $mockCache
                );
@@ -2264,7 +2220,7 @@ class WatchedItemStoreUnitTest extends PHPUnit_Framework_TestCase {
                        ->method( 'delete' )
                        ->with( '0:SomeDbKey:1' );
 
-               $store = new WatchedItemStore(
+               $store = $this->newWatchedItemStore(
                        $this->getMockLoadBalancer( $mockDb ),
                        $mockCache
                );